package cn.edu.tju.elm.service;

import cn.edu.tju.elm.model.Cart;
import cn.edu.tju.core.model.User;

import java.util.List;

public interface CartService {
    Cart addCartItem(Cart cart, User currentUser);
    List<Cart> getCartItems(User currentUser);
    Cart getCartItem(Long id, User currentUser);
    Cart updateCartItem(Long id, Cart cartDetails, User currentUser);
    void deleteCartItem(Long id, User currentUser);
    void clearCart(User currentUser);
    CartSummary getCartSummary(User currentUser);
    List<Cart> getCartItemsByBusinessId(User currentUser, Long businessId);
    
    // 购物车摘要内部类
    class CartSummary {
        private int totalItems;
        private double totalAmount;
        private int itemCount;
        
        // 构造方法
        public CartSummary() {}
        
        public CartSummary(int totalItems, double totalAmount, int itemCount) {
            this.totalItems = totalItems;
            this.totalAmount = totalAmount;
            this.itemCount = itemCount;
        }
        
        // getters and setters
        public int getTotalItems() {
            return totalItems;
        }
        
        public void setTotalItems(int totalItems) {
            this.totalItems = totalItems;
        }
        
        public double getTotalAmount() {
            return totalAmount;
        }
        
        public void setTotalAmount(double totalAmount) {
            this.totalAmount = totalAmount;
        }
        
        public int getItemCount() {
            return itemCount;
        }
        
        public void setItemCount(int itemCount) {
            this.itemCount = itemCount;
        }
    }
}
